import 'package:flutter/material.dart';
import 'package:flutter_app/widget/LoadingDialog.dart';
//import 'package:fluttertoast/fluttertoast.dart';
class BaseWidget extends StatefulWidget {
  @override
  State<BaseWidget> createState() => BaseWidgetState();
}

class BaseWidgetState<T extends BaseWidget> extends State<T> {
  BuildContext context;
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    this.context=context;
    return Scaffold(
      appBar: appbar("测试",null),
      body: new Container(
        color: Color.fromRGBO(0, 0, 0, 0),
      ),
    );
  }
  
  
  void showLoading(String s,bool dismissible){
  showDialog(context: context,
      barrierDismissible: dismissible,
      builder: (BuildContext context) {
        return new LoadingDialog( //调用对话框
          text: s==""?'正在获取详情...':s,
        );
      }
  );
    
  }

  Widget appbar(String title,List<Widget> actions){
    return AppBar(title: Text(title),
    centerTitle: true,
    leading: GestureDetector(
      child: Image.asset("images/back.png",fit: BoxFit.contain,),
      onTap: (){
        dispose();
      },
    ),
     actions: actions,
    );
  }

  void showToast(String msg){
//    Fluttertoast.showToast(msg: msg);
  }


}